<?php declare(strict_types=1);

namespace App\Enums;

use BenSampo\Enum\Enum;
use BenSampo\Enum\Exceptions\InvalidEnumMemberException;

/**
 * @method static static OptionOne()
 * @method static static OptionTwo()
 * @method static static OptionThree()
 */
final class ArticleType extends Enum
{
    //类型:0=常见问题,1=关于我们,2=隐私政策,3=售后政策,4=用户协议
    const QUESTION = 0;
    const ABOUT = 1;
    const PRIVACY_POLICY = 2;
    const AFTER_SALES_RULES = 3;
    const USER_AGREEMENT = 4;


    /**
     * @param mixed $value
     * @return string
     * @throws InvalidEnumMemberException
     */
    public static function getDescription(mixed $value): string
    {
        return match ($value) {
            self::QUESTION => '常见问题',
            self::ABOUT => '关于我们',
            self::PRIVACY_POLICY => '隐私政策',
            self::AFTER_SALES_RULES => '售后政策',
            self::USER_AGREEMENT => '用户协议',
            default => self::getKey($value),
        };
    }
}
